package com.opencv.controller;

import com.opencv.domain.vo.UserVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * @author qz.wu
 * @date 2021/12/15 13:31
 * @descriptions TODO
 */
@RestController
@RequestMapping("/date/formatter")
public class DateformatterController {

    private static List<UserVO> userList = new ArrayList<>();

    static {
        UserVO userVO = new UserVO();
        userVO.setUsername("张三");
        userVO.setSex(1);
        try {
            userVO.setBirthday(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("1993-03-13 10:00:00"));
            userList.add(userVO);
            userVO = new UserVO();
            userVO.setUsername("李四");
            userVO.setSex(1);
            userVO.setBirthday(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("1990-03-13 10:00:00"));
            userList.add(userVO);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }

    @GetMapping("/user/list")
    @ApiOperation("获取用户列表数据")
    public List<UserVO> queryUserList() {
        return userList;
    }
}
